package sourcecode.scheduled;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class Main {

    public static void main(String[] args) throws InterruptedException {

        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss SSS");

        MyScheduledService scheduledService = new MyScheduledService();

        scheduledService.schedule(() -> System.out.println(LocalDateTime.now().format(formatter) + "这是100毫秒一次"),100);
        Thread.sleep(1000);
        scheduledService.schedule(() -> System.out.println(LocalDateTime.now().format(formatter) + "这是200毫秒一次"),200);
    }

}
